package com.taru.houseapp.service.impl;

import com.taru.houseapp.dao.IHCommentDao;
import com.taru.houseapp.dao.IOrderDao;
import com.taru.houseapp.entity.HouseComment;
import com.taru.houseapp.service.IHComService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IHComServiceImpl implements IHComService {

    @Autowired
    IHCommentDao commentDao;
    @Autowired
    IOrderDao orderDao;

    @Override
    public int insertHouseComment(HouseComment comment) {
        int code1= commentDao.insertHouseComment(comment);
        int code2=orderDao.updateOrderIsComment(comment.getOrderId());
        return code1 & code2;
    }

    @Override
    public int deleteHouseComment(List<Integer> ids) {

        return commentDao.deleteHouseComment(ids);
    }

    @Override
    public List<HouseComment> queryHouseComment(String houseId) {

        return commentDao.queryHouseComment(houseId);
    }
}
